package assdraw.model;

import java.awt.Color;
import java.awt.Rectangle;

import assdraw.view.Visitor;



public class Rect extends Shape{

	private double width;
	private double height;
	
	public Rect(double x, double y, double width, double height, Color c){
		super(x,y,c);
		this.width = width;
		this.height = height;
	}

	public Rect(double x, double y, Color c){
		super(x,y,c);
		this.width = 40;
		this.height = 40;
	}


	@Override
	public void scale(double fx, double fy) {
		width = width*fx;
		height = height*fy;
	}

	@Override
	public boolean contains(double x2, double y2) {
		Rectangle r = new Rectangle((int)getX(), (int)getY(), (int)width, (int)height);
		return r.contains(x2, y2);
	}
	
	public double getWidth() {
		return width;
	}

	public void setWidth(double width) {
		this.width = width;
	}

	public double getHeight() {
		return height;
	}

	public void setHeight(double height) {
		this.height = height;
	}


	@Override
	public void accept(Visitor v) {
		v.visit(this);
	}


	@Override
	public Rectangle getBoundary() {
		return new Rectangle((int)getX(), (int)getY(), (int)width, (int)height);
	}
	
	
}
